--Api 表
/*
select * from SYS_Apis
select * from SYS_ApiM --M  Memo Main Manage

ReturnType
返回类型（类似返回值）
1 execSql 
2 openSql
3 execProc(不带返回结果) 
4 openProc(带返回结果集)
5 getList (使用getList sql 模板)
*/

declare 
  @ApiName varchar(50)='wp.tplSource',
  @ReturnType int =5
--
--
delete from SYS_Apis where ApiName=@ApiName
delete from SYS_ApiM where apiName=@ApiName
insert into SYS_ApiM([apiName],[name],[memo])
select @ApiName,'获取底稿模板来源','获取底稿模板来源tree, 在新建年度底稿来源那使用'
insert into SYS_Apis(ApiName,paramsLen,params,ReturnType,sqlText)
select @ApiName,0,
null,
@ReturnType,
'declare @dgly table(id nvarchar(100),pid nvarchar(100),fPath nvarchar(100),viewName nvarchar(255))
insert into @dgly select ''1'',null,null,''审计项目底稿'' insert into @dgly 
select ''2'',null,null,''审计底稿模板''
insert into @dgly 
select DBName,''1'',sjxmbh+''/''+zcbfID+''/'',zcbfName from sjxm_zcbf
insert into @dgly 
select mbmc,''2'',null,mbmc from mbsjjd group by mbmc select * from @dgly 
'
